##
##    This file is part of Metrix.
##
##    Metrix is free software: you can redistribute it and/or modify
##    it under the terms of the GNU General Public License as published by
##    the Free Software Foundation, either version 3 of the License, or
##    (at your option) any later version.
##
##    Metrix is distributed in the hope that it will be useful,
##    but WITHOUT ANY WARRANTY; without even the implied warranty of
##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##    GNU General Public License for more details.
##
##    You should have received a copy of the GNU General Public License
##    along with Metrix.  If not, see <http://www.gnu.org/licenses/>.
##

class VersionsController < ApplicationController

  layout "versions"
  active_scaffold :version do |config|
    config.label = "Versiones"
    config.columns = [:producto, :numero, :KLOC, :fecha_inicio, :fecha_fin_estimada, :fecha_fin_real,
						:recursos_estimados, :recursos_reales, :hs_hombre_estimadas, :hs_hombre_reales]
    config.list.columns = [:producto, :numero, 
							:fecha_inicio, :fecha_fin_estimada, :fecha_fin_real, :KLOC]
	config.list.sorting = [{:producto => :asc}, {:numero => :asc}]

	columns[:KLOC].description = "(Miles de líneas de código)"
	columns[:numero].label = "Número"
	columns[:numero].description = "(ejemplos: 1.0, 0.5 alfa, 2.1 beta)"
	columns[:fecha_fin_real].description = "(fecha de lanzamiento)"
	columns[:recursos_estimados].description = "(cantidad de personas involucradas)"

	#para que muestre un dropdown menu en vez de un editbox :)
	columns[:producto].ui_type = :select

	##para ofrecer una buena navegabilidad sin moverse demasiado entre listas
	#columns[:numero].set_link('nested', :parameters => {:associations => "incidentes"})

	## Busqueda ajax
	config.actions.swap :search, :live_search

	## Castellano
	config.actions = [:show, :update, :delete, :create, :list, :live_search]
	config.show.link.label = 'Ver'
	config.update.link.label = 'Modificar'
	config.delete.link.label = 'Borrar'
	config.create.link.label = 'Crear'
	config.live_search.link.label = 'Buscar'
  end

end
